package com.junzhiit.nengji.cms.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.junzhiit.nengji.bo.VipGoodsBO;
import com.junzhiit.nengji.cms.service.VipGoodsService;
import com.junzhiit.nengji.cms.web.util.ViewObjectUtil;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.VipGoodsVO;
import com.junzhiit.nengji.dao.VipGoodsDAO;

@Service
public class VipGoodsServiceImpl implements VipGoodsService{

	@Autowired
	private VipGoodsDAO vipGoodsDAO;
	
	@Override
	public Map<String, Object> findByVipId(DataTablesParamVO dtp, VipGoodsVO vipGoodsVO) {
		VipGoodsBO vipGoodsBO = new VipGoodsBO();
		BeanUtils.copyProperties(vipGoodsVO, vipGoodsBO);
		List<VipGoodsBO> list = vipGoodsDAO.findByVipId(vipGoodsBO, dtp.getStart(), dtp.getLength());
		int totalCount = vipGoodsDAO.getTotalCount(vipGoodsBO);
		
		return ViewObjectUtil.dataTables(list, dtp.getDraw(), totalCount);
	}

	
}
